package org.web.ssm.dao;

import org.apache.ibatis.annotations.Param;
import org.web.ssm.model.OrderDetail;
import org.web.ssm.model.queryVo.BaseQuery;
import org.web.ssm.model.wechatModel.Statis;

import java.util.List;

/**
 * Created by LUOLIANG on 2016/6/13.
 */
public interface OrderDetailMapper {
    /**
     * 查找单个订单
     *
     * @param orderid
     * @return
     */
    OrderDetail selectByPrimaryKey(String orderid);

    /**
     * 查询所有订单
     *
     * @return
     */
    List<OrderDetail> selectAll();

    /**
     * 根据用户查找订单
     *
     * @param userid
     * @param type
     * @return
     */
    List<OrderDetail> selectAllByUser(@Param("userid") String userid, @Param("type") String type);

    /**
     * 根据周或月进行求和函数查询
     *
     * @param userid
     * @param type
     * @return
     */
    List<Statis> selectSumBytime(@Param("userid") String userid, @Param("type") String type);

    Integer insertOrder(OrderDetail orderDetail);

    List<OrderDetail> orderlistByUser(BaseQuery<OrderDetail> topicQuery);

    int getCount(BaseQuery<OrderDetail> topicQuery);

    Integer updateUserMoney(@Param("userid") String userid, @Param("money") String money);
}
